package world.snowcrystal.commons.model.dto;

import lombok.Data;
import world.snowcrystal.commons.model.enums.ApplicationResponseStatusCode;

import java.io.Serializable;

/**
 * 通用返回类
 *
 * @param <T>
 *
 *
 */
@Data
public class BaseResponse<T> implements Serializable {

    private int code;

    private T data;

    private String message;

    public BaseResponse(int code, T data, String message) {
        this.code = code;
        this.data = data;
        this.message = message;
    }

    public BaseResponse(int code, T data) {
        this(code, data, "");
    }

    public BaseResponse(ApplicationResponseStatusCode applicationResponseStatusCode) {
        this(applicationResponseStatusCode.getCode(), null, applicationResponseStatusCode.getMessage());
    }
}
